﻿@model IEnumerable<RegistrationManagement.Models.Registration>
@{
    ViewBag.Title = "Index";
}
<h2>
    Index</h2>
<table>
    <tr>
        <td>@Html.ActionLink("Create New", "Create")
        </td>
        <td>
           <img alt="loading" id="loadingIndicator" src="@Url.Content("~/Content/images/Loading.gif")" style="display:none"/>
        </td>
        <td>
            <div>
                @using (Ajax.BeginForm("Search", "Registration",
                        new AjaxOptions()
                            {
                                InsertionMode = InsertionMode.Replace,
                                UpdateTargetId = "reglist",
                                LoadingElementId = "loadingIndicator",
                                HttpMethod = "get"
                            }))
                {
                    @Html.TextBox("q", null)
                    <input id="Submit1" type="submit" value="Search" />
                }
            </div>
        </td>
    </tr>
</table>
<br/>
<table id="reglist">
    <tr>
        <th>
            HardwardId
        </th>
        <th>
            IssueDate
        </th>
        <th>
            Requester
        </th>
        <th>
            CompanyId
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.HardwardId)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.IssueDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ContactInfo.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ContactInfo.Company.Name)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.RegistrationId }) |
                @Html.ActionLink("Details", "Details", new { id = item.RegistrationId }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.RegistrationId })
            </td>
        </tr>
    }
</table>
